package com.example.Laboratory.Mapper;


import com.example.Laboratory.Entity.Researcher;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ResearcherMapper {

    //增加研究队伍-人员名单信息
    @Insert("INSERT INTO researcher(researcher_name,researcher_degree,researcher_duty,researcher_direction,researcher_remarks)VALUES(#{researcher_name},#{researcher_degree},#{researcher_duty},#{researcher_direction},#{researcher_remarks})")
    int addResearcher (Researcher r);

    //根据id删除研究队伍-人员名单信息
    @Delete("Delete from researcher where researcher_id=#{researcher_id}")
    int deleteResearcher (int researcher_id);

    //查找全表信息根据教授，副教授，高级工程师，讲师排序
    @Select("SELECT * FROM researcher WHERE researcher_duty = '教授' ORDER BY researcher_remarks ")
    List<Researcher> researchResearcher1 ( );

    @Select("SELECT * FROM researcher WHERE researcher_duty = '副教授' ")
    List<Researcher> researchResearcher2 ( );

    @Select("SELECT * FROM researcher WHERE researcher_duty = '高级工程师' ")
    List<Researcher> researchResearcher3 ( );

    @Select("SELECT * FROM researcher WHERE researcher_duty = '讲师' ")
    List<Researcher> researchResearcher4 ( );


    //修改研究队伍-人员名单信息
    @Update("UPDATE researcher SET researcher_name=#{researcher_name},researcher_degree=#{researcher_degree},researcher_duty=#{researcher_duty},researcher_direction=#{researcher_direction},researcher_remarks=#{researcher_remarks} WHERE researcher_id=#{researcher_id}")
    int reviseResearcher (Researcher r);

}
